﻿#ifndef DOWNLOADTSFILEMANAGER_H
#define DOWNLOADTSFILEMANAGER_H

#include <QObject>
#include <QSet>

class DownloadTsFileManager : public QObject
{
    Q_OBJECT
public:
    explicit DownloadTsFileManager(QString strUrl, QString strSavePath);
    ~DownloadTsFileManager();

    //开始下载
    void DownTsFiles();
    //删除临时文件
    void DeleteTempFiles();

    //获取aria2的状态
    int getGlobalStatas();
    //清理completed/error/removed的下载请求
    int purgeDownloadResult();
protected:
    void DownM3u8File();
    int  VerifyM3u8File();
    QStringList  AnalysisM3u8();
    //发送Ts文件下载链接到aria2
    void PostTsToAria2(const QStringList& lstUrl);




    void MergeTsFiles();
signals:
    void sigDownMessage(QString);
public slots:

private:
    QString m_strUrl;
    QString m_strSavePath;

    QString m_strTmpDir;
    QString m_strM3u8File;
    QString m_strTsDir;


    QString m_strAria2Url;

    QList<QString> m_lstTsName;
    QList<QString> m_lstTsGid;
};

#endif // DOWNLOADTSFILEMANAGER_H
